<!doctype html>
<html class="default no-js">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>AdaptiveLightingTransitionCurveEntry | hap-nodejs</title>
	<meta name="description" content="Documentation for hap-nodejs">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="../assets/css/main.css">
	<script async src="../assets/js/search.js" id="search-script"></script>
</head>
<body>
<header>
	<div class="tsd-page-toolbar">
		<div class="container">
			<div class="table-wrap">
				<div class="table-cell" id="tsd-search" data-index="../assets/js/search.json" data-base="..">
					<div class="field">
						<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
						<input id="tsd-search-field" type="text" />
					</div>
					<ul class="results">
						<li class="state loading">Preparing search index...</li>
						<li class="state failure">The search index is not available</li>
					</ul>
					<a href="../index.html" class="title">hap-nodejs</a>
				</div>
				<div class="table-cell" id="tsd-widgets">
					<div id="tsd-filter">
						<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
						<div class="tsd-filter-group">
							<div class="tsd-select" id="tsd-filter-visibility">
								<span class="tsd-select-label">All</span>
								<ul class="tsd-select-list">
									<li data-value="public">Public</li>
									<li data-value="protected">Public/Protected</li>
									<li data-value="private" class="selected">All</li>
								</ul>
							</div>
							<input type="checkbox" id="tsd-filter-inherited" checked />
							<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
						</div>
					</div>
					<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
				</div>
			</div>
		</div>
	</div>
	<div class="tsd-page-title">
		<div class="container">
			<ul class="tsd-breadcrumb">
				<li>
					<a href="../modules.html">hap-nodejs</a>
				</li>
				<li>
					<a href="adaptivelightingtransitioncurveentry.html">AdaptiveLightingTransitionCurveEntry</a>
				</li>
			</ul>
			<h1>Interface AdaptiveLightingTransitionCurveEntry</h1>
		</div>
	</div>
</header>
<div class="container container-main">
	<div class="row">
		<div class="col-8 col-content">
			<section class="tsd-panel tsd-hierarchy">
				<h3>Hierarchy</h3>
				<ul class="tsd-hierarchy">
					<li>
						<span class="target">AdaptiveLightingTransitionCurveEntry</span>
					</li>
				</ul>
			</section>
			<section class="tsd-panel-group tsd-index-group">
				<h2>Index</h2>
				<section class="tsd-panel tsd-index-panel">
					<div class="tsd-index-content">
						<section class="tsd-index-section ">
							<h3>Properties</h3>
							<ul class="tsd-index-list">
								<li class="tsd-kind-property tsd-parent-kind-interface"><a href="adaptivelightingtransitioncurveentry.html#brightnessadjustmentfactor" class="tsd-kind-icon">brightness<wbr>Adjustment<wbr>Factor</a></li>
								<li class="tsd-kind-property tsd-parent-kind-interface"><a href="adaptivelightingtransitioncurveentry.html#duration" class="tsd-kind-icon">duration</a></li>
								<li class="tsd-kind-property tsd-parent-kind-interface"><a href="adaptivelightingtransitioncurveentry.html#temperature" class="tsd-kind-icon">temperature</a></li>
								<li class="tsd-kind-property tsd-parent-kind-interface"><a href="adaptivelightingtransitioncurveentry.html#transitiontime" class="tsd-kind-icon">transition<wbr>Time</a></li>
							</ul>
						</section>
					</div>
				</section>
			</section>
			<section class="tsd-panel-group tsd-member-group ">
				<h2>Properties</h2>
				<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
					<a name="brightnessadjustmentfactor" class="tsd-anchor"></a>
					<h3>brightness<wbr>Adjustment<wbr>Factor</h3>
					<div class="tsd-signature tsd-kind-icon">brightness<wbr>Adjustment<wbr>Factor<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
					<aside class="tsd-sources">
						<ul>
							<li>Defined in <a href="https://github.com/homebridge/HAP-NodeJS/blob/95a2490/src/lib/controller/AdaptiveLightingController.ts#L221">lib/controller/AdaptiveLightingController.ts:221</a></li>
						</ul>
					</aside>
					<div class="tsd-comment tsd-typography">
						<div class="lead">
							<p>The color temperature actually set to the color temperature characteristic is dependent
								on the current brightness value of the lightbulb.
								This means you will always need to query the current brightness when updating the color temperature
								for the next transition step.
								Additionally you will also need to correct the color temperature when the end user changes the
							brightness of the Lightbulb.</p>
						</div>
						<p>The brightnessAdjustmentFactor is always a negative floating point value.</p>
						<p>To calculate the resulting color temperature you will need to do the following.</p>
						<p>In short: temperature + brightnessAdjustmentFactor * currentBrightness</p>
						<p>Complete example:</p>
						<pre><code class="language-js"><span style="color: #0000FF">const</span><span style="color: #000000"> </span><span style="color: #0070C1">temperature</span><span style="color: #000000"> = ...; </span><span style="color: #008000">// next transition value, the above property</span>
<span style="color: #008000">// below query the current brightness while staying the the min/max brightness range (typically between 10-100 percent)</span>
<span style="color: #0000FF">const</span><span style="color: #000000"> </span><span style="color: #0070C1">currentBrightness</span><span style="color: #000000"> = </span><span style="color: #267F99">Math</span><span style="color: #000000">.</span><span style="color: #795E26">max</span><span style="color: #000000">(</span><span style="color: #001080">minBrightnessValue</span><span style="color: #000000">, </span><span style="color: #267F99">Math</span><span style="color: #000000">.</span><span style="color: #795E26">min</span><span style="color: #000000">(</span><span style="color: #001080">maxBrightnessValue</span><span style="color: #000000">, </span><span style="color: #0070C1">CHARACTERISTIC_BRIGHTNESS_VALUE</span><span style="color: #000000">));</span>

<span style="color: #008000">// as both temperature and brightnessAdjustmentFactor are floating point values it is advised to round to the next integer</span>
<span style="color: #0000FF">const</span><span style="color: #000000"> </span><span style="color: #0070C1">resultTemperature</span><span style="color: #000000"> = </span><span style="color: #267F99">Math</span><span style="color: #000000">.</span><span style="color: #795E26">round</span><span style="color: #000000">(</span><span style="color: #001080">temperature</span><span style="color: #000000"> + </span><span style="color: #001080">brightnessAdjustmentFactor</span><span style="color: #000000"> * </span><span style="color: #001080">currentBrightness</span><span style="color: #000000">);</span>
</code></pre>
					</div>
				</section>
				<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
					<a name="duration" class="tsd-anchor"></a>
					<h3><span class="tsd-flag ts-flagOptional">Optional</span> duration</h3>
					<div class="tsd-signature tsd-kind-icon">duration<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
					<aside class="tsd-sources">
						<ul>
							<li>Defined in <a href="https://github.com/homebridge/HAP-NodeJS/blob/95a2490/src/lib/controller/AdaptiveLightingController.ts#L228">lib/controller/AdaptiveLightingController.ts:228</a></li>
						</ul>
					</aside>
					<div class="tsd-comment tsd-typography">
						<div class="lead">
							<p>The duration in milliseconds this exact temperature value stays the same.
								When we transition to to the temperature value represented by this entry, it stays for the specified
								duration on the exact same value (with respect to brightness adjustment) until we transition
							to the next entry (see <a href="adaptivelightingtransitioncurveentry.html#transitiontime">transitionTime</a>).</p>
						</div>
					</div>
				</section>
				<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
					<a name="temperature" class="tsd-anchor"></a>
					<h3>temperature</h3>
					<div class="tsd-signature tsd-kind-icon">temperature<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
					<aside class="tsd-sources">
						<ul>
							<li>Defined in <a href="https://github.com/homebridge/HAP-NodeJS/blob/95a2490/src/lib/controller/AdaptiveLightingController.ts#L196">lib/controller/AdaptiveLightingController.ts:196</a></li>
						</ul>
					</aside>
					<div class="tsd-comment tsd-typography">
						<div class="lead">
							<p>The color temperature in mired.</p>
						</div>
					</div>
				</section>
				<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
					<a name="transitiontime" class="tsd-anchor"></a>
					<h3>transition<wbr>Time</h3>
					<div class="tsd-signature tsd-kind-icon">transition<wbr>Time<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
					<aside class="tsd-sources">
						<ul>
							<li>Defined in <a href="https://github.com/homebridge/HAP-NodeJS/blob/95a2490/src/lib/controller/AdaptiveLightingController.ts#L238">lib/controller/AdaptiveLightingController.ts:238</a></li>
						</ul>
					</aside>
					<div class="tsd-comment tsd-typography">
						<div class="lead">
							<p>The time in milliseconds the color temperature should transition from the previous
								entry to this one.
								For example if we got the two values A and B, with A.temperature = 300 and B.temperature = 400 and
								for the current time we are at temperature value 300. Then we need to transition smoothly
								within the B.transitionTime to the B.temperature value.
								If this is the first entry in the Curve (this value is probably zero) and is the offset to the transitionStartMillis
							(the Date/Time were this transition curve was set up).</p>
						</div>
					</div>
				</section>
			</section>
		</div>
		<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
			<nav class="tsd-navigation primary">
				<ul>
					<li class=" ">
						<a href="../modules.html">Exports</a>
					</li>
				</ul>
			</nav>
			<nav class="tsd-navigation secondary menu-sticky">
				<ul class="before-current">
				</ul>
				<ul class="current">
					<li class="current tsd-kind-interface">
						<a href="adaptivelightingtransitioncurveentry.html" class="tsd-kind-icon">Adaptive<wbr>Lighting<wbr>Transition<wbr>Curve<wbr>Entry</a>
						<ul>
							<li class=" tsd-kind-property tsd-parent-kind-interface">
								<a href="adaptivelightingtransitioncurveentry.html#brightnessadjustmentfactor" class="tsd-kind-icon">brightness<wbr>Adjustment<wbr>Factor</a>
							</li>
							<li class=" tsd-kind-property tsd-parent-kind-interface">
								<a href="adaptivelightingtransitioncurveentry.html#duration" class="tsd-kind-icon">duration</a>
							</li>
							<li class=" tsd-kind-property tsd-parent-kind-interface">
								<a href="adaptivelightingtransitioncurveentry.html#temperature" class="tsd-kind-icon">temperature</a>
							</li>
							<li class=" tsd-kind-property tsd-parent-kind-interface">
								<a href="adaptivelightingtransitioncurveentry.html#transitiontime" class="tsd-kind-icon">transition<wbr>Time</a>
							</li>
						</ul>
					</li>
				</ul>
				<ul class="after-current">
				</ul>
			</nav>
		</div>
	</div>
</div>
<footer>
	<div class="container">
		<h2>Legend</h2>
		<div class="tsd-legend-group">
			<ul class="tsd-legend">
				<li class="tsd-kind-constructor tsd-parent-kind-interface"><span class="tsd-kind-icon">Constructor</span></li>
				<li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li>
				<li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">Method</span></li>
			</ul>
			<ul class="tsd-legend">
				<li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li>
				<li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li>
				<li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li>
			</ul>
			<ul class="tsd-legend">
				<li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited constructor</span></li>
				<li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited property</span></li>
				<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited method</span></li>
			</ul>
			<ul class="tsd-legend">
				<li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static property</span></li>
				<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static method</span></li>
			</ul>
		</div>
	</div>
</footer>
<div class="overlay"></div>
<script src="../assets/js/main.js"></script>
</body>
</html>